﻿using _01_Prism_No.Views;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace _01_Prism_No.ViewModels
{
    public class MainWindowViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler? PropertyChanged;

        public Command ShowCommand { get { return new Command(ShowContent); } }

        public MainWindowViewModel()
        {

        }

        private void ShowContent(string ViewName)
        {
            if (ViewName == "UCA")
                UserContent = new UCA();
            else if (ViewName == "UCB")
                UserContent = new UCB();
            else if (ViewName == "UCC")
                UserContent = new UCC();
        }

        private void OnPropertyChanged(string ViewName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(ViewName));
        }

        private UserControl _UserContent;

        public UserControl UserContent
        {
            get
            {
                if (_UserContent == null)
                    _UserContent = new Views.UCB();
                return _UserContent;
            }
            set
            {
                _UserContent = value;
                OnPropertyChanged(nameof(UserContent));
            }
        }
    }
}
